import Vue from 'vue'
import store from './store'
import App from './App'
import icon from './components/icon'
import share from './utils/share.js'
Vue.mixin(share)

Vue.component('h-icon', icon) // 图标全局注册
import zhouWeiNavBar from "@/components/zhouWei-navBar"
Vue.component("nav-bar", zhouWeiNavBar) // 头部导航

import uniTabbar from "@/components/uni-tabbar"
Vue.component("uni-tabbar", uniTabbar) // 删除等二次确认弹框

import uniPop from "@/components/uni-pop"
Vue.component("uni-pop", uniPop) // 删除等二次确认弹框

import uniMsg from "@/components/uni-msg"
Vue.component("uni-msg", uniMsg) // 支付弹出层

import uniActionsheet from "@/components/uni-actionsheet"
Vue.component("uni-actionsheet", uniActionsheet) // 动作面板

import empty from "@/components/empty"
Vue.component("empty", empty) // 空页面

import uniButton from "@/components/button"
Vue.component("uni-button", uniButton) // 校验是否登录按钮

import uniAddress from "@/components/address"
Vue.component("uni-address", uniAddress) // 选择地址
/**
 *  css部分使用了App.vue下的全局样式和iconfont图标，有需要图标库的可以留言。
 *  示例使用了uni.scss下的变量, 除变量外已尽量移除特有语法,可直接替换为其他预处理器使用
 */
const msg = (title, duration=1500, mask=false, icon='none')=>{
	//统一提示方便全局修改
	if(Boolean(title) === false){
		return;
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}

const prePage = (page=2)=>{
	let pages = getCurrentPages();
	let prePage = pages[pages.length - page];
	// #ifdef H5
	return prePage;
	// #endif
	return prePage.$vm;
}

Vue.config.productionTip = false
Vue.prototype.$fire = new Vue();
Vue.prototype.$store = store;
Vue.prototype.$api = {msg, prePage};
//接口
import apis from './utils/api/api.js'
Vue.prototype.$apis = apis
//过滤器
import filters from './utils/filters'
filters(Vue)
App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()